<?php
    include('./_connect.php');

    $username = $_REQUEST['username'];
    $password = $_REQUEST['password'];
    $phone = $_REQUEST['phone'];

    $sql = "select * from user where user_name='$username'";

    $result = $mysqli->query($sql);

    if($result->num_rows>0){
        echo '用户名已存在';
        die;
    }
    
    $sql_ins = "insert into user(user_name,pass_word,phone)values('$username','$password','$phone')";

    $res = $mysqli->query($sql_ins);

    if($res){
        echo "<script>alert('注册成功');location.href='../html/debark.html';</script>";
    }
   
?>